 //-----------------------------标签切换--------------------							

function setTab(Tabname,TabCountNumber,n,ByTagName){
	//alert(Tabname+"--"+TabCountNumber+"--"+n+"--"+ByTagName);
	  var menu=document.getElementById(Tabname).getElementsByTagName("li");
	  var showdiv=document.getElementById(TabCountNumber).getElementsByTagName(ByTagName);  
	  for(i=0;i<menu.length;i++)
	  {
		  menu[i].className=i==n?"current":"";   
		  showdiv[i].style.display=i==n?"block":"none";  
		  }
}


 	 

 $(document).ready(function(){
	var defaultOpts = { interval: 4000, fadeInTime: 300, fadeOutTime: 200 };
		var _titles = $(".hotpic .h_menu li");
		var _bodies = $(".hotpic .pic_list ul");
		var _count = _titles.length;
		var _current = 0;
		var _intervalID = null;
		var stop = function() { window.clearInterval(_intervalID); };
		var slide = function(opts) {
			if (opts) {
				_current = opts.current || 0;
			} else {
				_current = (_current >= (_count - 1)) ? 0 : (++_current);
			};
			_bodies.filter(":visible").fadeOut(defaultOpts.fadeOutTime, function() {
				_bodies.eq(_current).fadeIn(defaultOpts.fadeInTime);
				_bodies.removeClass("current").eq(_current).addClass("current");
			});
			_titles.removeClass("current").eq(_current).addClass("current");
		};
		var go = function() {
			stop();
			_intervalID = window.setInterval(function() { slide(); }, defaultOpts.interval);
		}; 
		var itemMouseOver = function(target, items) {
			stop();
			var i = $.inArray(target, items);
			slide({ current: i });
		}; 
		_titles.hover(function() { if($(this).attr('class')!='current'){itemMouseOver(this, _titles); }else{stop();}}, go);
		_bodies.hover(stop, go);
		go();				
 						

 //-----------------------------焦点图轮播2--------------------- 
  
var t = n = 0, count = $("#playShow blockquote").size();
	$("#playShow blockquote:not(:first-child)").hide();
	$("#playNum a:first").addClass("num_current");
	$("#playNum a").mousemove(function() {
	   var i = $(this).text() - 1;
	   n = i;
	   if (i >= count) return;
	   $("#playShow blockquote").filter(":visible").hide().parent().children().eq(i).show();
	   $(this).addClass("num_current").siblings().removeClass("num_current");
	});
	t = setInterval(showAuto, 4000);
	$("#play").hover(function(){clearInterval(t)},
					function(){t = setInterval(showAuto, 4000);});
	
	function showAuto()
	{
		n = n >= (count - 1) ? 0 : ++n;
		$("#playNum a").eq(n).trigger('mousemove');
	}  
 
 
 
 
});
 
 
 
